package com.ting.etp.loader.launcher;


import com.ting.etp.loader.launcher.coexist.EtpIsolationBaseLauncher;
import com.ting.etp.loader.runner.EtpMethodRunner;
import com.ting.etp.loader.start.EtpStart;
import lombok.AllArgsConstructor;

/**
 * 开发环境 Launcher
 *
 * @author zifang
 */
@AllArgsConstructor
public class EtpDevLauncher implements EtpLauncher<ClassLoader>{

    private final EtpStart etpStart;

    @Override
    public ClassLoader run(String... args) throws Exception {
        EtpMethodRunner etpMethodRunner = new EtpMethodRunner(etpStart.getClass().getName(),
                SPRING_BOOTSTRAP_RUN_METHOD, args);
        EtpAbstractMainLauncher launcher;
//        if(DevelopmentModeSetting.isolation()){
            launcher = new EtpIsolationBaseLauncher(etpMethodRunner);
//        } else if(DevelopmentModeSetting.coexist()) {
//            launcher = new CoexistBaseLauncher(methodRunner);
//        } else {
//            throw DevelopmentModeSetting.getUnknownModeException();
//        }

        return launcher.run(args);
    }
}
